#modname "More Machaka 0.23 Alpha"
#description "This mod adds an EA Machaka, and will some day add an LA as well."
#version 0.23
#icon "./MoreMachaka/EA_Machaka.tga"
#domversion 3.28

------------ Developer Notes ------------

Mod Compatibility: None guaranteed, though I tried to work around the Awesome* mods as best I could and I will work on lining it up with the Mod Compatibility Project soon.

This mod is by Schneeble.  I acknowledge that it probably has little to do with what Illwinter has in mind for Machaka's arc, but dammit I like dinosaurs.
That being said, if there ever is an official nation number 6 (Machaka, Lion Kings) then this mod would overwrite it! 

Many thanks go to builds character for helping me come up with original idea, to NinjaDebugger for helping me with many of the early unit designs,
  and to the alpha testers for helping with the version updates 0.11 through 0.16:  Xanrick, Lilli, builds character, Dawkish, and Tenjou Utena.

If you have feedback regarding this mod, please find me on IRC (#dom3goons on irc.synirc.net).
I'm sure it's not the most balanced nation in the game, but I do want it to be good enough to take in a vanilla game but not so good that everybody wants it all the time.

------------ Full Change Log ------------

0.10 (Initial build)
Spell 87 (supposedly unused) was coopted for the Divine Messenger's onebattlespell.
0.11
Gold and resource costs are currently in flux; it's alpha after all.
Fireres 1 added to all nonhuman units (will not get extra fatigue in heat).
Pyroraptors were given stealth +0.
Troodons changed from poorleader to goodleader.
0.12
Impenetrable hide removed from all units.
0.13
Updated Diviner sprites and nation color.
Created "Leap" attack and gave it to Hungry Flame to replace Bite.  As an unintended side effect this makes them immune to coral hauberks and other poison armor.
Added Oracle multihero, Voice of the Divine hero, and Beastmaster hero.
Added a new nametype (151) to hold ONLY the Beastmaster hero's name.
0.14
Updated various unit and national descriptions.
Voice of the Divine changed from assassin to spy and made into a unique multihero.
Fireres 1 removed, it works but is not really necessary.  I could have set it to 5 or 10 to prevent any amount of heat from causing fatigue but heat preference of 2 is fine.
Swamp survival added to all therapod units and commanders.
0.15
Updated attack sprite for Hungry Flame to show leap attack.
Added Hungry Flame summon, "Call Hungry Flames"
Moved "Call of the Hunt" spell from 87 to 94 to stop breaking that one LA Pythium spell that nobody ever casts.
   It turns out that spell 87 is the part of that Orgy spell that makes maenads.  94 should be unused.
0.16
Lowered cost of Divine Messenger, added "Leap" attack to Divine Messenger and Divine Guard.
Lowered Machakan human encumbrance to 2 as per MA Machaka human units.
   Note: Gold costs will probably be adjusted frequently for a little while after this mod goes into wider use.
   Note: Both multihero slots have been filled but only one normal hero slot has.  A few more normal hero slots are available if anybody has good ideas.  A pteranodon with magic paths, maybe..?
0.17
All dinosaur units changed to MM3.  Human mages left at MM2 for the time being, what with the fluff and all.
Conflicts with the Master Alchemist in AwesomeGods at monster #2711 compel me to add 10 to all the monster ids.  I'm staking out monster numbers 2711 through 2740!
Added "Leap" to the Voice of the Divine hero.
0.18
Added the "Bony Frill" armor type back to Spearhead, which I must have removed accidentally with the Impenetrable Hide back in 0.12.
Desaturate Tyrant sprite and doublecheck all sprites for black pixel noise cleanup.  My desaturation wasn't as good as Sombre's example but there it is.
0.19
Added neanderthal... it did not work out; dead version, skip.
0.20
The "realism" (nerf) patch!
Changed Spearhead and Hammertail to be cold-blooded.
Removed swamp survival from therapods (was added in 0.14).
Spearhead's "Bony Frill" parry value reduced from 6 to 4, which I think it was always supposed to be.
Reduced dino speeds very slightly (AP 20 changed to 19 and AP 30 changed to 29).  In cases of movement across only one axis that means that they move one less square.
   Note: I have strongly considered changing the Tyrant's "Swallow" attack to a custom version that is single-target only, but gameplay balance seems to be okay so I will leave it alone for now.
I found a filename case issue that I had missed in the nation section.  I apologize for not catching that earlier!
0.21
Cost adjustments and Tyrant balancing.  Despite assurances from a few veterans, in practice nobody is actually playing with anything other than Tyrants and their early game is perhaps a bit too strong.
Tyrant's main attack changed from Swallow to Bite (ap).  This is of course a major change, and I suspect that we will end up somewhere in between the two.  Hit Points decreased to 63.  Gold cost decreased to 120.
Resource cost of Hammertails, Spearheads, and Tyrants all increased slightly (you know, for training gear).
Gold cost of Sorcerer increased to 210, research penalty reduced from -3 to -2.
Gold cost of Diviner decreased to 120, base S1 lowered to no paths (which means that they can be recruited without labs, but also that they have a max of S2 instead of S3), research bonus decreased from +3 to +2.
Added #poormagicleader to Diviner and to Oracle multihero, which should have little impact but matches the flavor and will tie into the related LA mages.
Oracle multihero paths changed to eliminate the possibility of ridiculously high S mages.  Research bonus decreased from +3 to +2.
Typo found and fixed in "Call Hungry Flames" spell, though the fix has no mechanical effect.
0.22
Decided to leave the Beastmaster hero unit with his Swallow attack.
Lowered maximum ages of most dinosaurs by varying amounts.  They still have long lives, just not quite as long as before.  Also removed specific max age from the humans.
Increased Protection from 9 to 13, raised cost from 120 to 125.
Lowered the cost of Hammertail and Spearhead units from 60 and 90 to 45 and 75 respectively.
Raised resource costs of all dinosaurs just a bit more.
Changed Diviner random chances to trend more strongly toward S2 and away from pathless, lowered healer to raised cost from 120 back to 130.
0.23
Calahan from Dom3mods (http://z7.invisionfree.com/Dom3mods/) gave me some great advice and inspiration regarding diviners and witch doctors.  This update is dedicated to him!
Lowered the cost of Hammertail and Spearhead units again (35 and 55 respectively).
Raised the attack of Hammertail by 1 but gave its tail weapon an attack penalty.
Raised the attack of Spearhead by 2 and defense by 1, but switched its "Gore" attack to the standard one.
Both of the above changes bring the herbivore dinosaurs more in line with boar-type monsters and on balance only increase the Spearhead's net attack by 1.
Brought Witch Doctor sprites in so that I could customize the unit.
Added a new unit 2723 "Witch Doctor" that is equally likely to have just N1 as it is any of several combinations including FEDN.  It cannot have more than 2 ranks in any path besides N and it cannot have ED crosspaths.
Put one base rank of S back on the Diviner and changed the random chances to make S3 a small (10%) net possibility with S1 and S2 equally (45%) likely.  Raised cost to 150.

To Do: Any additional tweaks that come up (like with cost), and start on LA.

------------ End Change Log ------------

------------ Contents ------------
--- Weapons (816-820)
--- Armor (276)
--- Names (151-151)
--- Units (2711-2722) (reserved through 2740 please!)
--- Spells (94, "Call Hungry Flames")
--- Sites (812-813)
--- Nations (6 for EA and ?? for LA)

--- Weapons ---

--Ankylosaur tail
#newweapon 816
#name "Tail Bludgeon"
#dmg 3
#att -1
#len 1
#flail
#sound 11
#bonus
#end

--Triceratops charge, does not get 'charge' feature because it deals str-based dmg once or twice to same target
#newweapon 817
#name "Heavy Charge"
#dmg 0
#len 0
#secondaryeffectalways 818
#bonus
#ammo 1
#end

--Charge effect
#newweapon 818
#name "Small Trample"
#dmg 0
#aoe 1
#end

--819 Reserved, was triceratops gore

--Raptor leap
#newweapon 820
#name "Leap"
#dmg 0
#att 1
#len 6
#sound 38
#bonus
#end

--- Armor ---

--Bony frill for triceratops
#newarmor 276
#name "Bony Frill"
#type 4
#prot 0
#def 4
#enc 0
#rcost 1
#end

--- Names ---
#selectnametype 151
#clear
#addname "Osuka"
#end

--- Units ---

--Machaka Archer (#879)

--Machaka Warrior (#880)

--Ankylosaur
#newmonster 2711
#name "Hammertail"
#spr1 "./MoreMachaka/ankylosaur.tga"
#spr2 "./MoreMachaka/ankylosaur_atk.tga"
#descr "The Hammertail is a stout beast with a tough, knotty hide and a flexible tail with a large bone bludgeon at the end.  Most Hammertails are trained as pack animals, but many serve the warriors of Machaka as guardians and as living battering rams."
#ap 13
#mapmove 3
#hp 37
#prot 16
#size 4
#ressize 4
#str 18
#enc 3
#att 10
#def 9
#prec 5
#mr 11
#mor 9
#gcost 35
#rcost 6
#weapon 816
#eyes 2
#animal
#coldblood
#maxage 60
#siegebonus 5
#noitem
#nametype 126
#noleader
#end

--Triceratops
#newmonster 2712
#name "Spearhead"
#spr1 "./MoreMachaka/triceratops.tga"
#spr2 "./MoreMachaka/triceratops_atk.tga"
#descr "The Spearhead is a massive beast with a bony frill behind its skull and three sharp horns growing from its nose and brow.  Many Spearheads are trained as pack animals, but most serve the warriors of Machaka as guardians and as shock troops."
#ap 19
#mapmove 3
#hp 54
#prot 11
#size 5
#ressize 5
#str 19
#enc 3
#att 11
#def 10
#prec 5
#mr 11
#mor 9
#gcost 55
#rcost 8
#weapon 817
#weapon 331
#armor 276
#eyes 2
#animal
#coldblood
#maxage 60
#noitem
#nametype 126
#noleader
#end

--Pyroraptor
#newmonster 2713
#name "Hungry Flame"
#spr1 "./MoreMachaka/pyroraptor.tga"
#spr2 "./MoreMachaka/pyroraptor_atk.tga"
#descr "The Hungry Flame is a tiny, clever predator with scales that shimmer like fire when it moves.  Hungry Flames are seen by the people of Machaka as the embodiment of fire, lightning, rage, and male sexuality.  They are therefore held sacred and have grown fond enough of their human companions to follow them to war."
#ap 19
#mapmove 3
#hp 6
#prot 1
#size 1
#ressize 1
#str 7
#enc 3
#att 11
#def 12
#prec 9
#mr 12
#mor 9
#gcost 6
#rcost 1
#weapon 820
#eyes 2
#holy
#animal
#forestsurvival
#stealthy 0
#maxage 30
#noitem
#nametype 126
#noleader
#end

--Tyrannosaur (cap only)
#newmonster 2714
#name "Tyrant King"
#spr1 "./MoreMachaka/tyrannosaur.tga"
#spr2 "./MoreMachaka/tyrannosaur_atk.tga"
#descr "The Tyrant King is the premier predator of the valley, huge and fast and cunning but not above surviving on carrion in leaner times.  Tyrant Kings are seen by the people of Machaka as the embodiment of war, labor, sacrifice, and even politics.  They are therefore held sacred, and those who are raised in the company of humans and Divine Messengers will hunt and fight for the people of Machaka and their god."
#ap 19
#mapmove 3
#hp 63
#prot 13
#size 6
#ressize 6
#str 21
#enc 3
#att 13
#def 11
#prec 11
#mr 12
#mor 10
#gcost 125
#rcost 11
#weapon 319
#weapon 408
#eyes 2
#holy
#animal
#forestsurvival
#maxage 45
#noitem
#nametype 126
#noleader
#end

--Troodon (Summoned by Troodon Hunter)
#newmonster 2715
#name "Divine Guard"
#spr1 "./MoreMachaka/troodon.tga"
#spr2 "./MoreMachaka/troodon_atk.tga"
#descr "The Divine Guard is an extremely intelligent, human-sized omnivore with feathers covering most of its body.  Divine Guards are the lesser packmates of a Divine Messenger and will almost always be found at the side of their alpha.  Like the Divine Messengers they are held sacred by the people of Machaka."
#ap 29
#mapmove 3
#hp 12
#prot 3
#size 2
#ressize 2
#str 11
#enc 3
#att 13
#def 13
#prec 13
#mr 13
#mor 10
#gcost 60
#rcost 2
#weapon 20
#weapon 820
#eyes 2
#holy
#animal
#forestsurvival
#darkvision 50
#stealthy 20
#assassin
#maxage 90
#itemslots 15494
#nametype 126
#noleader
#end

--Pteranodon Scout
#newmonster 2716
#name "Grandfather Bird"
#spr1 "./MoreMachaka/pteranodon.tga"
#spr2 "./MoreMachaka/pteranodon_atk.tga"
#descr "The Grandfather Bird is not actually a bird but a flying, fish-eating reptile with a huge wingspan.  The name comes from their wrinkly appearance, their lack of teeth, their raspy and wavering calls, and their tendency to spend most of their time fishing.  The Diviners of Machaka breed and train these beasts and imbue them with powers of speech and memory; thus they are fit to serve as scouts."
#ap 3
#mapmove 3
#hp 9
#prot 1
#size 2
#ressize 2
#str 9
#enc 3
#att 9
#def 9
#prec 9
#mr 12
#mor 9
#gcost 20
#rcost 2
#weapon 404
#eyes 2
#animal
#coldblood
#flying
#sailing
#stealthy 0
#maxage 60
#itemslots 28672
#nametype 126
#noleader
#end

-- Machaka Chief (#881)

-- Troodon Hunter
#newmonster 2717
#name "Divine Messenger"
#spr1 "./MoreMachaka/trohunter.tga"
#spr2 "./MoreMachaka/trohunter_atk.tga"
#descr "The Divine Messenger is an extremely intelligent, human-sized omnivore with feathers covering most of its body.  Divine Messengers are seen by the people of Machaka as messengers between the mortal and spirit worlds, harbingers of beginnings and endings, and guardians of crossroads.  They are therefore held sacred, and they have not only mastered the Machakan language but also become the nation's foremost keepers of tradition and spirituality.  Divine Messengers are known to be dignified and impish by turns, and they are as likely to oversee sombre ceremonies as they are to infiltrate foreign lands to raise mischief.  Divine Messengers always travel with a pair of packmates known as Divine Guards, and their powerful singing voices bring divine inspiration to human and beast alike, all across the battlefield."
#ap 29
#mapmove 3
#hp 12
#prot 3
#size 2
#ressize 2
#str 11
#enc 3
#att 13
#def 13
#prec 13
#mr 13
#mor 10
#gcost 210
#rcost 2
#weapon 20
#weapon 820
#eyes 2
#holy
#animal
#forestsurvival
#darkvision 50
#stealthy 20
#assassin
#maxage 90
#itemslots 15494
#magicskill 8 1
#onebattlespell 94
#nametype 126
#goodleader
#end

-- Diviner
#newmonster 2718
#name "Diviner"
#spr1 "./MoreMachaka/diviner.tga"
#spr2 "./MoreMachaka/diviner_atk.tga"
#descr "The Diviners are sorceresses who draw power from the world all around them, even from the stars in the distant heavens.  The voices of the spirits can be heard in all things, and it is the task of the Diviner to hear them, to ponder their meaning, and to direct the tribe with that knowledge.  The Diviners brought several Lion Tribes to the lost valley long ago, and they continue to direct their people in matters large and small.  They have been happy to turn over religious rites to the Divine Messengers as they feel their time is better spent in research, medicine, and politics.  Diviners make excellent researchers, healers, and planners, but because they are not chosen based on magical skill alone they can have varying levels of astral power."
#ap 13
#mapmove 2
#hp 9
#prot 0
#size 2
#ressize 2
#str 9
#enc 2
#att 10
#def 11
#prec 10
#mr 14
#mor 12
#gcost 150
#rcost 1
#weapon 7
#eyes 2
#female
#forestsurvival
#healer 50
#heal
#researchbonus 2
#nobadevents 5
#itemslots 15494
#magicskill 4 1
#custommagic 2048 40
#custommagic 2048 25
#nametype 125
#poorleader
#poormagicleader
#end

-- Sorcerer
#newmonster 2719
#name "Sorcerer"
#spr1 "./MoreMachaka/sorcerer.tga"
#spr2 "./MoreMachaka/sorcerer_atk.tga"
#descr "The Sorcerers are Machakan mages with innate magical ability in one of three fields of power.  Sorcerers lack in versatility but not in raw power.  They tend to be brash young men eager to make names for themselves.  They are at the forefront of the recent push to spread Machakan might beyond the confines of the lost valley in spite of the warnings of the Diviners.  In time they will lead most of their people to the distant God Mountain and God Forest, but at the moment they are merely striving to exert their power and shake free of the Diviners' meddling and the Messengers' chirping."
#ap 13
#mapmove 2
#hp 10
#prot 0
#size 2
#ressize 2
#str 10
#enc 2
#att 10
#def 10
#prec 10
#mr 14
#mor 12
#gcost 210
#rcost 1
#weapon 7
#eyes 2
#forestsurvival
#itemslots 15494
#magicskill 6 1
#custommagic 12416 300
#nametype 126
#poorleader
#end

-- Oracle
#newmonster 2720
#name "Oracle"
#spr1 "./MoreMachaka/oracle.tga"
#spr2 "./MoreMachaka/oracle_atk.tga"
#descr "The Oracles are exceptionally wise and powerful sorceresses who lead the Diviners from their council in the heart of the Lost Valley.  This particular Oracle has decided to take more active role in leading her people to victory in support of their awakening god."
#ap 13
#mapmove 2
#hp 11
#prot 0
#size 2
#ressize 2
#str 9
#enc 2
#att 10
#def 11
#prec 10
#mr 14
#mor 12
#gcost 0
#rcost 1
#weapon 7
#eyes 2
#female
#forestsurvival
#healer 50
#heal
#researchbonus 2
#nobadevents 20
#itemslots 15494
#magicskill 4 1
#custommagic 8960 100
#custommagic 11008 200
#nametype 125
#okleader
#poormagicleader
#end

-- Voice of the Divine
#newmonster 2721
#name "Voice of the Divine"
#spr1 "./MoreMachaka/divinevoice.tga"
#spr2 "./MoreMachaka/divinevoice_atk.tga"
#descr "Very rarely a Divine Messenger is born with brilliant golden feathers.  Such Messengers are invariably fantastic students of theology, warfare, and spycraft, and they are taught by the best teachers and the brightest minds that Machaka has to offer.  After years of rigorous training a golden-plumed Messenger is granted the title of Voice of the Divine.  Divine Guards flock to protect and to hear the wisdom of this remarkable priest."
#ap 29
#mapmove 3
#hp 15
#prot 3
#size 2
#ressize 2
#str 11
#enc 3
#att 13
#def 13
#prec 13
#mr 13
#mor 10
#gcost 0
#rcost 2
#weapon 20
#weapon 820
#weapon 403
#eyes 2
#holy
#animal
#unique
#forestsurvival
#darkvision 50
#stealthy 20
#spy
#maxage 90
#standard 15
#itemslots 15494
#magicskill 8 3
#onebattlespell 94
#domsummon2 2715
#nametype 126
#expertleader
#end

-- Beastmaster
#newmonster 2722
#name "Beastmaster"
#spr1 "./MoreMachaka/beastmaster.tga"
#spr2 "./MoreMachaka/beastmaster_atk.tga"
#descr "As a child, Osuka was possessed by the spirit of the hunt and disappeared into the wilderness for three days.  He returned dragging a young hammertail he had slain by himself.  He left again on another hunt several months later, and returned with a juvenile Spearhead.  His trips into the wilderness became more frequent as he grew older, until on his sixteenth birthday he disappeared altogether.  Years later he returned to his village a man grown, wielding a great bone bow that no other man could draw and riding on the back of a wild Tyrant King.  He is a strong and cunning hunter and his tyrant king mount is obedient only to him.  His near-content possession by the spirit of the hunt surrounds him with an aura of menace that inspires his allies and terrifies his enemies."
#ap 19
#mapmove 3
#hp 72
#prot 13
#size 6
#ressize 6
#str 21
#enc 3
#att 15
#def 13
#prec 12
#mr 12
#mor 15
#gcost 0
#rcost 11
#weapon 266
#weapon 461
#weapon 408
#eyes 2
#mounted
#holy
#animal
#forestsurvival
#maxage 90
#standard 5
#animalawe 1
#fear 0
#itemslots 13446
#nametype 151
#goodleader
#end

-- Witch Doctor
#newmonster 2723
#name "Witch Doctor"
#spr1 "./MoreMachaka/witch_doctor.tga"
#spr2 "./MoreMachaka/witch_doctor_atk.tga"
#descr "Witch doctors are reclusive Machakan magic users whose abilities have more in common with the rituals of their Lion Tribe forebears than with the wild power of the Sorcerers that have made their home in the Fields of Tar.  Witch Doctors shun contact with other mages and never reveal any magic secrets willingly.  These habits make them very poor magical researchers."
#ap 13
#mapmove 2
#hp 10
#prot 0
#size 2
#ressize 2
#str 10
#enc 2
#att 10
#def 10
#prec 10
#mr 13
#mor 12
#gcost 90
#rcost 1
#weapon 7
#eyes 2
#forestsurvival
#researchbonus -2
#itemslots 15494
#magicskill 6 1
#custommagic 8320 60
#custommagic 5120 60
#nametype 126
#poorleader
#end

--- Spells ---

#selectspell 94
#clear
#name "Call of the Hunt"
#descr "Calls a pair of Divine Guards and blesses the entire battlefield."
#school -1
#researchlevel 0
#path 0 -1
#damage 2715
#effect 1
#nreff 2
#range 0
#fatiguecost 0
#nextspell 758
#end

#newspell
#name "Call Hungry Flames"
#descr "The caster prepares a large feast of fresh carrion surrounded by a circle of enchanted torches before casting this ritual.  Over the course of several days, dozens of Hungry Flames will arrive to eat and will be bound to serve the caster when they have had their fill."
#school 0
#researchlevel 3
#path 0 6
#pathlevel 0 2
#damage 2713
#effect 10001
#fatiguecost 700
#nreff 40
#restricted 6
#end

--- Sites ---

#newsite 812
#name "Lost Valley"
#path 6
#level 0
#rarity 5
#loc 16384
#gems 6 2
#gems 4 1
#homemon 2714
#end

#newsite 813
#name "Fields of Tar"
#path 5
#level 0
#rarity 5
#loc 16384
#gems 5 1
#gems 0 1
#gems 6 1
#homecom 2719
#end

--- Nations ---

#selectnation 6
#clearnation
#name "Machaka"
#epithet "Lost Valley"
#era 1
#description "Long ago a predominant Lion Tribe uncovered a hot, lush valley untouched by time.  They settled the land and tamed its beasts for labor and for war.  The valley possesses magical qualities that have spared its flora and fauna from the ravages of time for thousands of years.  These same qualities have given its natural inhabitants long natural lives and a small degree of magical resistance.  Although the Diviners of the young nation of Machaka do not yet fully understand how to tap these energies for their own use, they are dedicated to understanding its mysteries.  The sorcerers of Machaka meanwhile seek adventure and power, and they constantly urge the chieftains among their people to leave behind the natterings of women and lizards.  The arrival of their god has brought all major political factions in Machaka together, and while each Machakan may have very different personal motiviations they all seek to prove the might and righteousness of their divinity."
#summary "Mages are high in power, low in diversity; powerful sacred units hindered by low morale and very expensive priests."
#brief "Machaka is a warm land with powerful mages and mighty shock troops.  Individual mages are not particularly versatile, and both sacred and nonsacred troops alike are expensive.  Some human infantry is available but most troops are massive reptilian beasts."
#color 230 85 0
#flag "./MoreMachaka/EA_Machaka.tga"
#labcost 500
#templecost 400
#templepic 0
#clearrec
#startcom 881
#startscout 2716
#startunittype1 879
#startunitnbrs1 20
#startunittype2 880
#startunitnbrs2 20
#addrecunit 879
#addrecunit 880
#addrecunit 2711
#addrecunit 2712
#addrecunit 2713
#addreccom 2716
#addreccom 881
#addreccom 2723
#addreccom 2718
#addreccom 2717
#multihero1 2720
#multihero2 2721
#hero2 2722
#defcom1 881
#defcom2 2718
#defunit1 879
#defunit1b 880
#defunit2 2711
#defunit2b 2712
#defmult1 10
#defmult1b 10
#defmult2 5
#defmult2b 5
#clearsites
#startsite "Lost Valley"
#startsite "Fields of Tar"
#idealcold -2
#startfort 3
#defaultfort 32
#farmfort 3
#mountainfort 1
#forestfort 34
#swampfort 11
#end